package com.zhuangjie.shop.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 商家评价的dto
 *
 * @author zhuangjie
 * @date 2024/04/25
 */
@Getter
@Setter
public class ShopEvaluateDTO {
    @ApiModelProperty("订单的id")
    @TableField("order_id")
    @NotNull(message = "订单的id不能为空")
    private Long orderId;

    @ApiModelProperty("店铺的id")
    private Long shopId;

    @ApiModelProperty("分数(值0-5)")
    @TableField("score")
    @Min(value = 0, message = "分数不能小于0")
    @Max(value = 5, message = "分数不能大于5")
    private Byte score;

    @ApiModelProperty("是否匿名评价")
    @TableField("is_anonymous")
    @Min(value = 0, message = "是否匿名评价的值只能是0或1")
    @Max(value = 1, message = "是否匿名评价的值只能是0或1")
    private Byte isAnonymous;

    @ApiModelProperty("用户给予的评价")
    @TableField("evaluate")
    private String evaluate;

    @ApiModelProperty("用户晒图")
    @TableField("images")
    private String images;

    @ApiModelProperty("订单菜品评价")
    private List<ShopDishEvaluate> shopDishEvaluateList;

    @Data
    public static class ShopDishEvaluate {

        @ApiModelProperty("菜品id")
        @TableField("dish_id")
        @NotBlank(message = "菜品id不能为空")
        private Long dishId;

        @ApiModelProperty("情感倾向(0 差 1好)")
        @TableField("sentiment")
        @Min(value = 0, message = "情感倾向的值只能是0或1")
        @Max(value = 1, message = "情感倾向的值只能是0或1")
        private Byte sentiment;
    }

}
